package com.modern.model;

import com.modern.model.BaseObject;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.Table;

import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;

import java.io.Serializable;

@Entity
@Table(name="typingSource",catalog="TypingTest")
public class TypingSource extends BaseObject implements Serializable {
    private Long sourceId;
    private String sourceName;
    private String sourceContent;

    @Id @GeneratedValue(strategy = GenerationType.AUTO)    
    public Long getSourceId() {
        return this.sourceId;
    }
    
    public void setSourceId(Long sourceId) {
        this.sourceId = sourceId;
    }
    
    @Column(name="sourceName", nullable=false, length=45)
    public String getSourceName() {
        return this.sourceName;
    }
    
    public void setSourceName(String sourceName) {
        this.sourceName = sourceName;
    }
    
    @Column(name="sourceContent", nullable=false, length=1000)
    public String getSourceContent() {
        return this.sourceContent;
    }
    
    public void setSourceContent(String sourceContent) {
        this.sourceContent = sourceContent;
    }

    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        TypingSource pojo = (TypingSource) o;

        if (sourceName != null ? !sourceName.equals(pojo.sourceName) : pojo.sourceName != null) return false;
        if (sourceContent != null ? !sourceContent.equals(pojo.sourceContent) : pojo.sourceContent != null) return false;

        return true;
    }

    public int hashCode() {
        int result = 0;
        result = (sourceName != null ? sourceName.hashCode() : 0);
        result = 31 * result + (sourceContent != null ? sourceContent.hashCode() : 0);

        return result;
    }

    public String toString() {
        StringBuffer sb = new StringBuffer(getClass().getSimpleName());

        sb.append(" [");
        sb.append("sourceId").append("='").append(getSourceId()).append("', ");
        sb.append("sourceName").append("='").append(getSourceName()).append("', ");
        sb.append("sourceContent").append("='").append(getSourceContent()).append("'");
        sb.append("]");
      
        return sb.toString();
    }

}
